#include <iostream>
using namespace std;
template <class T>
void Swap(T &x, T &y)
{
    T tmp = x;
    x = y;
    y = tmp;
}
int main()
{
    int n = 1, m = 2;
    cout <<"n = "<<n <<", m = " << m <<endl;
    Swap(n, m);
    cout <<"交换后n = "<<n << ", m = " << m <<endl;
    double f = 1.2, g = 2.3;
    cout <<"f = "<<f << ", g = " << g <<endl;
    Swap(f, g);
    cout <<"交换后f = "<<f << ", g = " << g <<endl;
    return 0;
}